package util;

import java.io.IOException;
import java.util.Map;

import com.itranswarp.compiler.JavaStringCompiler;


	public class Main {

	    public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
	        JavaStringCompiler compiler = new JavaStringCompiler();
	        Map<String, byte[]> results = compiler.compile("UserProxy.java", JAVA_SOURCE_CODE);
	        Class<?> clazz = compiler.loadClass("util.UserProxy", results);
	        // try instance:
	        User user = (User) clazz.newInstance();
	        System.out.println(user.isDirty());
	      
	    }

	    static final String JAVA_SOURCE_CODE = "/* a single java source file */   "
	            + "package util;                                            "
	            + "public class UserProxy extends util.User {                     "
	            +"     String name;                    "
	            + "    boolean _dirty = false;                                    "
	            + "    public void setId(String id) {                             "
	            + "        super.setId(id);                                       "
	            + "        setDirty(true);                                        "
	            + "    }                                                          "
	            + "    public void setName(String name) {                         "
	            + "        super.setName(name);                                   "
	            + "        setDirty(true);                                        "
	            + "    }"
	            + "    public String getName(){                                   "
	            + "                    return name;                                            "
	            + "}                                                      "
	            + "    public void setCreated(long created) {                     "
	            + "        super.setCreated(created);                             "
	            + "        setDirty(true);                                        "
	            + "    }                                                          "
	            + "    public void setDirty(boolean dirty) {                      "
	            + "        this._dirty = dirty;                                   "
	            + "    }                                                          "
	            + "    public boolean isDirty() {                                 "
	            + "        return this._dirty;                                    "
	            + "    }                                                          "
	            + "}                                                              ";
	}

